import request from '@/utils/request'

// 查询入库管理列表
export function listInbound(query) {
  return request({
    url: '/inbound/inbound/list',
    method: 'get',
    params: query
  })
}
// 查询销售退货管理列表
export function listRejected(query) {
  return request({
    url: '/inbound/rejected/list',
    method: 'get',
    params: query
  })
}
// 获取编码
export function getCode(code) {
  return request({
    url: '/inbound/inbound/getcode?code=' + code,
    method: 'post'
  })
}
// 查询入库管理详细
export function getInbound(inventoryId) {
  return request({
    url: '/inbound/inbound/' + inventoryId,
    method: 'get'
  })
}



// 修改入库管理
export function updateInbound(data) {
  return request({
    url: '/inbound/inbound',
    method: 'put',
    data: data
  })
}
// 修改入库明细管理
export function updateInboundDetalis(data) {
  return request({
    url: '/inbound/detalis',
    method: 'put',
    data: data
  })
}

// 删除入库管理
export function delInbound(inventoryId) {
  return request({
    url: '/inbound/inbound/' + inventoryId,
    method: 'delete'
  })
}
// 下拉列表
export function selectAllSysDept() {
  return request({
    url: '/inbound/inbound/selectAllSysDept',
    method: 'get'
  })
}

export function selectAllSysDeptByID(parent) {
  return request({
    url: '/inbound/inbound/selectAllSysDeptByID?deptid=' + parent,
    method: 'get'
  })
}
export function selectAllSysUserByParentId(parent) {
  return request({
    url: '/inbound/inbound/selectAllSysUserByParentId?deptid=' + parent,
    method: 'get'
  })

}
//供应商下拉
export function selectAllPySuppliers() {
  return request({
    url: '/inbound/inbound/selectAllPySuppliers',
    method: 'get'
  })

}
//仓库下拉
export function selectAllBsWarehouse() {
  return request({
    url: '/inbound/inbound/selectAllBsWarehouse',
    method: 'get'
  })
}
//根据供应商查询联系人联系电话
export function selectSuppliersByid(supplierId) {
  return request({
    url: '/inbound/inbound/selectSuppliersByid?supplierId=' + supplierId,
    method: 'get'
  })

}
//关联进货单号列表查询
export function selectAllOdPurchaseOrder(query) {
  return request({
    url: '/inbound/inbound/selectAllOdPurchaseOrder',
    method: 'get',
    params: query
  })

}
//进货单号详细列表查询
export function selectAllOdPurchaseDetails(query) {
  return request({
    url: '/inbound/inbound/selectAllOdPurchaseDetails',
    method: 'get',
    params: query
  })

}
//根据库位编号商品编号查询库存
export function selectWhInventoryByCode(query) {
  return request({
    url: '/inbound/inbound/selectWhInventoryByCode',
    method: 'get',
    params: query
  })

}
export function selectAllBsWhLocation(warehouseId) {
  return request({
    url: '/inbound/inbound/selectAllBsWhLocation', // 修正 URL
    method: 'get',
    params: { warehouseId: warehouseId }, // 将仓库 ID 作为查询参数传递
  });
}
//新增入库明细
export function adddetalis(data) {
  return request({
    url: '/inbound/detalis/add',
    method: 'post',
    data: data,
  })

}

// 入库统计图
export function selectPyInboundStatistics(dateBeginEnd) {
  return request({
    url: '/inbound/inbound/date',
    method: 'get',
    params: dateBeginEnd
  })
}



// 新增入库管理
export function addInbound(data) {
  return request({
    url: '/inbound/inbound/add',
    method: 'post',
    data: data
  })
}
export function updateStatus(data) {
  return request({
    url: '/inbound/inbound/updateStatus',
    method: 'post',
    data: data
  })
}

export function selectAllPyInboundDetalisBycodeXQ(inventoryNumber) {
  return request({
    url: '/inbound/detalis/selectAllPyInboundDetalisBycodeXQ', // 修正 URL
    method: 'get',
    params: { inventoryNumber: inventoryNumber }, // 将仓库 ID 作为查询参数传递
  });
}
//关联退货单号列表查询
export function selectAllOdInRejected(query) {
  return request({
    url: '/inbound/inbound/selectAllOdInRejected',
    method: 'get',
    params: query
  })

}
//退货单号详细列表查询
export function selectOdSaleRejectedDetailsList(query) {
  return request({
    url: '/inbound/rejected/selectOdSaleRejectedDetailsList',
    method: 'get',
    params: query
  })

}



// 入库排名
export function selectPyInboundRanking() {
  return request({
    url: '/inbound/inbound/ranking',
    method: 'get',
  })
}


// 查询入库流水
export function inPyInboundLS(query) {
  return request({
    url: '/inbound/inbound/inPyInboundLS',
    method: 'get',
    params: query
  })
}
export function inTotal() {
  return request({
    url: '/inbound/inbound/inTotal',
    method: 'get',

  })
}
export function outTotle() {
  return request({
    url: '/inbound/outbound/outTotle',
    method: 'get',

  })
}
// 查询出库流水
export function WhOutboundLS(data) {
  return request({
    url: '/inbound/outbound/WhOutboundLS',
    method: 'post',
    data: data
  })
}
export function whInventoryTotle() {
  return request({
    url: '/inbound/inventory/whInventoryTotle',
    method: 'get',

  })
}
// 查询出库流水
export function WhInventoryList(query) {
  return request({
    url: '/inbound/inventory/WhInventoryList',
    method: 'get',
    params: query
  })
}
// 查询部门下拉树结构
export function deptTreeSelect() {
  return request({
    url: '/inbound/user/deptTree',
    method: 'get'
  })
}
